// Package canvas
// desc: x
// author: Locker
// date: 2024/6/8
// version: 1.0.0
package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
	"image/color"
	"time"
)

func main() {
	a := app.New()
	w := a.NewWindow("canvas")
	mCanvas := w.Canvas()

	blue := color.NRGBA{
		R: 0,
		G: 0,
		B: 180,
		A: 255,
	}
	rect := canvas.NewRectangle(blue)
	mCanvas.SetContent(rect)

	go func() {
		time.Sleep(time.Second)
		green := color.NRGBA{R: 0, G: 180, B: 0, A: 255}
		rect.FillColor = green
		rect.Refresh()
	}()

	w.Resize(fyne.NewSize(100, 100))
	w.ShowAndRun()
}
